{% extends "admin_base.html" %}
{% block bodycontent %}

{% if events_list %}
<h1>Create a local admin</h1>
<h1>Choose an incident: </h1>
  <form method=POST action="/admin">
  {% if errors %}
<section id="errors">
  <header>The submission had errors</header>
  <article>
    <ul>
    {% for k in errors %}
      <li class="error">
        {% for e in errors[k] %}
          {{k}}: {{e}}
        {% endfor %}
      </li>
    {% endfor %}
    </ul>
  <article>
</section>
{% endif %}
<select name="choose_event">
{% for result in events_list %}
<option value="{{result.key().id()}}">{{result.name}}</option>
{% endfor %}
</select>
{% endif %}
<h2>Personal Information</h2>
  <div>{{ form.contact_first_name.label }}: {{ form.contact_first_name }}</div>
  <div>{{ form.contact_last_name.label }}: {{ form.contact_last_name }}</div>
  <div>{{ form.contact_email.label }}: {{ form.contact_email }}</div>
  <div>{{ form.contact_phone.label }}: {{ form.contact_phone }}</div>
<h2>Organization Information</h2>
  <div>{{ form.name.label }}: {{ form.name }}</div>
  <div>{{ form.email.label }}: {{ form.email }}</div>
  <div>{{ form.phone.label }}: {{ form.phone }}</div>
  <div>{{ form.address.label }}: {{ form.address }}</div>
  <div>{{ form.city.label }}: {{ form.city }}</div>
  <div>{{ form.state.label }}: {{ form.state }}</div>
  <div>{{ form.zip_code.label }}: {{ form.zip_code }}</div>
  <div>{{ form.twitter.label }}: {{ form.twitter }}</div>
  <div>{{ form.facebook.label }}: {{ form.facebook }}</div>
  <div>{{ form.url.label }}: {{ form.url }}</div>
  <p><strong>Auto generated password = {{auto_password}}</strong></p>
  <p><strong>Please keep for your records</strong></p>
  <input type=hidden name=password value={{auto_password}}>
  <input type=hidden name=create_admin value="True">
  <input type=submit value="Create Local Admin">
  </form>
{% endblock %}